package com.demo.Controller;

import com.demo.module.Student;
import com.demo.service.StudentSeivice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2023-05-24
 * Time:2:18
 */
@Controller
public class StudentController {
    //1.属性注入
    @Autowired
    @Qualifier("student1")
    private Student student;

//    //2.set 注入
//    @Autowired
//    public void setStudentSeivice(StudentSeivice studentSeivice) {
//        this.studentSeivice = studentSeivice;
//    }

//    //3.构造方法注入
//    public StudentController(StudentSeivice studentSeivice) {
//        this.studentSeivice = studentSeivice;
//    }

    @Bean
    public void sayHi(){
        //调用sevice方法
        System.out.println(student);;
    }
}
